Android Dev: The constructor Intent(new View.OnClickListener(){}, Class<DrinksTwitter>) is undefined

Posted by Malcolm Woods Spark on Stack Overflow See other posts from Stack Overflow or by Malcolm Woods Spark
Published on 2010-12-20T08:18:13Z Indexed on 2010/12/29 19:54 UTC
Read the original article Hit count: 216

Filed under:
|
package com.android.drinksonme;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class Screen2 extends Activity {



 // Declare our Views, so we can access them later
 private EditText etUsername;
 private EditText etPassword;
 private Button btnLogin;
 private Button btnSignUp;
 private TextView lblResult;

 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // Get the EditText and Button References
                etUsername = (EditText)findViewById(R.id.username);
                etPassword = (EditText)findViewById(R.id.password);
                btnLogin = (Button)findViewById(R.id.login_button);
                btnSignUp = (Button)findViewById(R.id.signup_button);
                lblResult = (TextView)findViewById(R.id.result);

             // Set Click Listener
                        btnLogin.setOnClickListener(new OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                // Check Login
                                String username = etUsername.getText().toString();
                                String password = etPassword.getText().toString();


         if(username.equals("test") && password.equals("test")){
         final Intent i = new Intent(this, DrinksTwitter.class);  //error on this line

                                 startActivity(i);


                                // lblResult.setText("Login successful.");


                                } else {
                                    lblResult.setText("Invalid username or password.");
                                }
                            }
                        });

                        final Intent k = new Intent(Screen2.this, SignUp.class);

                        btnSignUp.setOnClickListener(new OnClickListener() {

                            public void onClick(View v) {

                                startActivity(k);
                            }
                        });

 }
}

© Stack Overflow or respective owner

Related posts about android

Related posts about DEV